<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
  <style type="text/css">
	* {padding:0;margin:0;}
	li {list-style:none;}
	#qq {width: 225px;height: 500px;}
	#qq ul {width: 100%;height: 300px;float: left;}
  </style>
  <!-- <script src="/lib/jquery-1.7.1.min.js"></script> -->
  <!-- <script src="/lib/jquery-1.12.4.js"></script> -->
  <script>
	function log(){
		console.log.apply(this, arguments);
	};

	var helper = {
		color: '#112233',
		makeInstance: function(e) {
			var t = new Function;
			return t.prototype = e, e = new t, t.prototype = null, e;
		  },
		extend: function(e, t, n) {
			if (t)
			  for (var i in t) n && e.hasOwnProperty(i) || (e[i] = t[i]);
			return e;
		  },
	  inherits: function(e, t) {
		var n = e.prototype,
		  i = helper.makeInstance(t.prototype);
		helper.extend(i, n, !0);
		console.log(i.hasOwnProperty('a'));
		console.log('a' in i);
		e.prototype = i;
		console.log(e.prototype);
		console.log(i.__proto__);
		i.constructor = e;
		console.log(i);
		return e;
	  }
	};



	//function sub() {this.names = 'sub';}
	//function sup() {this.names = 'sup';}

	//sub.prototype = {a: function(){console.log('a');}};
	//sup.prototype = {b: function(){console.log('b');}};

	//var x = helper.inherits(sub, sup);
	//console.log(x);
	//console.log(typeof x);
	//console.log(x.toString());


function Person() {
	this.names = 'lili';
	this.ages = 123;
	this.say = function() {console.log(this.names)};
}
//var p  = new Person();

//console.log(Person);
//console.log(Person.prototype.__proto__);
//console.log(Person.prototype.__proto__['get __proto__']);
//console.log();
//console.log(Person.__proto__);
//console.log(Person.prototype.__proto__);
////console.log(Person.prototype.constructor);

//console.log(p);
//console.log(p.constructor);
//console.log(p.__proto__.constructor);
//console.log(p.constructor === p.__proto__.constructor);

//p.constructor.prototype.a = function(){console.log('haha p.constructor.prototype.a')};
//p.a()
//p.__proto__.constructor.prototype.b = function(){console.log('haha p.constructor.prototype.b')};
//p.b()

function Sub(){}

//Sub.prototype = new Person();
//console.log(Sub);
//console.log(Sub.prototype.constructor);

//Sub.prototype.constructor = Person;
//var s = new Sub();
//console.log(Sub);
//console.log(s);
//console.log(s instanceof Sub);
//console.log(s instanceof Person);

var arr = [1, 'bb'];
log(arr);
//log('arr.prototype', arr.prototype);
//log('prototype' in arr);
log(arr.__proto__ === Array.prototype);
log(arr.__proto__.__proto__.__proto__ === Array.prototype);

//var properties = [],
	//ownProperties = [];
//for (var i in arr)
//{
	//properties.push(i);
	//log('i', i, typeof i);
	//if (arr.hasOwnProperty(i))
	//{
		//log('i2', i);
		//ownProperties.push(i);
	//}
//}
//log(properties);
//log(ownProperties);



//var brr = new Array(1, 'bb');
//log(brr);

//var properties2 = [],
	//ownProperties2 = [];
//for (var i in brr)
//{
	//properties2.push(i);
	//if (brr.hasOwnProperty(i))
	//{
		//ownProperties2.push(i);
	//}
//}
//log(properties2);
//log(ownProperties2);

log(Array.prototype);
log(Array.prototype instanceof Array);
log(Array.prototype instanceof Object);
var properties = [],
	ownProperties = [];
for (var i in Array.prototype)
{
	properties.push(i);
	if (Array.prototype.hasOwnProperty(i))
	{
		ownProperties.push(i);
	}
}
log(properties);
log(ownProperties);



log(Array.prototype.concat);

log(arr.__proto__);
log(arr.__proto__ instanceof Array);
log(arr.__proto__ instanceof Object);
log(arr.__proto__.__proto__);
log(arr.__proto__.__proto__ instanceof Array);
log(arr.__proto__.__proto__ instanceof Object);
log(arr.__proto__.__proto__.__proto__);
log(arr.__proto__.__proto__.__proto__ instanceof Array);
log(arr.__proto__.__proto__.__proto__ instanceof Object);

log('\n\n\n\n');
var obj = {a:1, b:'bb'};
log(obj);
log('obj.prototype', obj.prototype);
log('prototype' in obj);
log('obj.__proto__', obj.__proto__);
log('typeof obj.__proto__', typeof obj.__proto__);
log();




log(Foo.__proto__ === Foo.prototype.prototypeA.__proto__);
log(Foo.__proto__.__proto__ === Foo.prototype.prototypeA.__proto__.__proto__);

function Bar(a, b, c=1) {
	log('Bar', a, b, c);
	this.a = 'Bar this.a';
	this.funcA = function() {log('Bar this.funcA()');};
	this.funcB = function() {log('Bar this.funcB()');};
}

Bar.prototype.prototypeA = function() {log('Bar.prototype.prototypeA()');};
Bar.prototype.prototypeB = function() {log('Bar.prototype.prototypeB()');};

log(Bar);
log(Foo.__proto__ === Bar.__proto__);


//log(Function);

//log(Function.toString());
/*
function Function() {
    [native code]
}
*/

//log(Function.length);
//log(Function.name);



log('\n---- boxx ----');
//function Function(a, b, c, d=1) {log(111, a, b, c, d);}
//log(Function);
//log(Function.length);
//log(Function.name);
/*
var boxx = new Function('a', 'b', 'log(a, b);');
log('boxx =>', boxx);
log('typeof boxx =>', typeof boxx);
log('boxx.toString() =>', boxx.toString());
log('boxx.length =>', boxx.length);
log('boxx.name =>', boxx.name);

*/






log('\n---- demo ----');
function demo(a, b, c=2){
	log(a, b, c);
}
log(demo);
log(demo.length);
log(demo.name);



function Aoo(p=2){
	this.a = 'Aoo this.a';
	this.funcA1 = function(){console.log('Aoo this.funcA1');};
	this.funcA2 = function(){console.log('Aoo this.funcA2');};
}
log('\n---- Aoo ----');
log(Aoo);
//log('typeof Aoo =>', typeof Aoo);
//log('typeof Aoo.prototype =>', typeof Aoo.prototype);


//log('typeof Aoo.__proto__ =>', typeof Aoo.__proto__);
//log('typeof Aoo.__proto__.apply =>', typeof Aoo.__proto__.apply);
//log('typeof Aoo.__proto__.call =>', typeof Aoo.__proto__.call);

//var insA = new Aoo();
//log();
//log(insA);
//log('insA.prototype', insA.prototype);
//log('insA.__proto__', insA.__proto__);
//log('typeof insA.__proto__', typeof insA.__proto__);

//log(Aoo.prototype);

log(Aoo.arguments);
log(Aoo.apply);
log(Aoo.constructor);
log(Aoo.name);
log(Aoo.__proto__.name);

var a = new Aoo();
log(a);


//function Foo(){
	//this.a = 'Foo this.a';
	//this.b = 'Foo this.b';
	//this.funcA1 = function(){console.log('Aoo this.funcA1');};
	//this.funcA2 = function(){console.log('Aoo this.funcA2');};
//}
//Foo.prototype = new Aoo();//JavaScript 原型继承

//log(Foo);
















/*
function My(){}
function You(){}
     
var myOne = new My();
console.info(myOne.__proto__.constructor)
console.info(myOne instanceof My)//true
console.info(myOne instanceof You)//false
 
My.prototype = {};  //修改了My.prototype
var myTwo = new My();
console.info(myTwo.__proto__.constructor)
console.info(myOne.__proto__.constructor)
console.info(myTwo instanceof My)//true
console.info(myOne instanceof My)//false,My.prototype指向了空
 
You.prototype = new My();  //修改了Your.prototype
var myThree = new You();
console.info(myThree instanceof You)//true
console.info(myThree instanceof My)//true
*/






















  </script>
 </head>
 <body id="iframe-body" contenteditable=true>
 helo
<div id="box" class='box' style="background-color: #ff6600;">s&#8203;s&#8203;s&#8203;s&nbsp;s&nbsp;s&nbsp;sssss</div>
<div id="box1" class='box'>box1</div>
<div id="box2" class='box'>box2</div>
<div id="box3" class='box'>box3</div>

<!--
<div id="qq">
	<ul>
		<li>11</li>
		<li>11</li>
		<li>11</li>
	</ul>
</div>
-->


<script type="text/javascript">



</script>
</body>
</html>
